<!DOCTYPE html>
<html lang="en">
{% extends 'app01/base_backend.html' %}
{% block person_manage %}
    <a class="navbar-brand" href="#">我的关注</a>
{% endblock %}
{% block all_li %}
    <li role="presentation" class="active">
        <a href="#home" aria-controls="home" role="tab" data-toggle="tab">我的关注</a></li>
    <li role="presentation" class="active">
        <a href="{{ back_url }}" style="color: #337ab7">返回个人管理</a></li>
{% endblock %}

{% block all_content %}

    {% block suibi %}
        <!--文章收藏显示页面-->
        <hr>
        {% for focu in fcou_obj %}
            <div class="media">
                <div class="media-left">
                    <a href="#">
                        <img height="60" class="media-object" src="/media/{{ focu.star_user.avatar }}/" alt="...">
                    </a>
                </div>
                <div class="media-body">
                    <h4 class="media-heading"><a
                            href="/app01/site/{{ focu.star_user.username }}?url={{ request.get_full_path_info }}"
                            target="_blank"> {{ focu.star_user.username }} </a></h4>
                    <h5>个人签名： {{ focu.star_user.blog.site_title }}</h5>
                </div>
            </div>
            <hr>

        {% empty %}
            <h3>您还未关注其他用户。</h3>
        {% endfor %}

        {# 分页显示 #}
        <div class="pager">
            <nav aria-label="Page navigation">
                <ul class="pagination">
                    {{ article_page_html }}
                </ul>
            </nav>
        </div>


    {% endblock %}

{% endblock %}

{% block js %}
    <script>
        if ('{{ request.user.username }}'.slice(0, 3) === '512') {
            $('#p_for_a').html('<a href="/app01/manage_student/" class="list-group-item">学生管理</a>')
            $('#role_for').html('角色：<br><a href="#">老师</a>')
        }


        if ('{{ request.user.username }}'.slice(0, 3) === '312') {

            $('#set_person_id').html('<p>班级：<input type="text" id="stu_class" class="form-control" value="{{ request.user.stu_class }}"></p>')
            $('#role_for').html('角色：<br><a href="#">学生</a>')
        }

          //文件上传的ajax请求
        $("#up_btn_id").click(function () {
            let formObj = new FormData()
            formObj.append('file', $('#up_file_id')[0].files[0])
            formObj.append('filename', $('#file_name_id').val())
            formObj.append('desc', $('#file_desc_id').val())
            let radio_chioce = $('input[name="share"]:checked').val();
            formObj.append('share', radio_chioce)

            $.ajax({
                url: "/app01/upload_file/",
                type: 'post',
                data: formObj,
                contentType: false,
                processData: false,
                success: function (array) {
                    if (array.code === 1000) {
                        alert(array.msg0)
                        parent.location.href = array.url
                    } else if (array.code === 2000) {
                        //用户输入不正确的提示
                        $('#p1').next().text(array.msg1)
                        $('#p2').next().text(array.msg2)
                        $('#p3').next().text(array.msg3)
                    } else {
                        alert(array.msg0)
                    }

                }
            })


        });
    </script>
{% endblock %}